package com.klondike.common.io;

import java.io.IOException;
import java.net.ServerSocket;

import javax.net.ServerSocketFactory;

public class NetUtils {
    private NetUtils() {
    }

    public static int findAnyFreePort() throws IOException {
        ServerSocket socket = ServerSocketFactory.getDefault().createServerSocket(0);
        int port = socket.getLocalPort();
        socket.close();
        return port;
    }

}
